package com.xjscrm.console.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjscrm.common.entity.WwCustomer;
import com.xjscrm.console.chat.frame.recv.RPullCustomerMsg;
import com.xjscrm.console.param.wwCustomer.CustomerCountDto;
import com.xjscrm.console.param.wwCustomer.CustomerQuery;
import com.xjscrm.console.param.wwCustomer.GetCustomerSelectPageQuery;
import com.xjscrm.console.vo.CountCustomerGenderVo;
import com.xjscrm.console.vo.CountCustomerSceneVo;
import com.xjscrm.console.vo.WwCustomerVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface WwCustomerMapper {

    Integer newTotalCustomerNumber(CustomerCountDto customerCountDto);

    List<CountCustomerSceneVo> countCustomerScene(CustomerCountDto customerCountDto);


    List<CountCustomerGenderVo> countCustomerGender(CustomerCountDto customerCountDto);

    int countCustomerByDeviceUniqueId(@Param("deviceUniqueId") Long deviceUniqueId, @Param("merId") Long merId);

    List<WwCustomerVo> getCustomer(CustomerQuery customerQuery);


    WwCustomer  getById(@Param("id") Long id, @Param("merId") Long merId);

    int updateWwCustomerMapper(WwCustomer wwCustomer);

    int insert(WwCustomer wwCustomer);

    int deleById(@Param("id") Long customerId, @Param("merId") Long merId);

    List<WwCustomerVo> getCustomerSelectPage(GetCustomerSelectPageQuery customerSelectPageQuery);

    WwCustomer getByWxId(@Param("wxid") String wxid, @Param("merId") Long merId);

    List<WwCustomer> pageByDeviceUniqueId(Page<WwCustomer> page, @Param("merId") Long merId, @Param("deviceUniqueId") Long deviceUniqueId);

    List<WwCustomer> pageByCondition(Page<WwCustomer> page, @Param("param") RPullCustomerMsg customer);

    void update(WwCustomer wwCustomer);

    WwCustomer getByDeviceAndWxid(@Param("wxid") String wxid, @Param("deviceUniqueId") Long deviceUniqueId, @Param("merId") Long merId);

    List<WwCustomer> getByIds(@Param("ids") List<Long> ids, @Param("merId") Long merId);

    List<Long> selectListByTimeAndRemarkAndGender(@Param("merId") Long merId, @Param("addStartTime") Integer addStartTime, @Param("addEndTime") Integer addEndTime, @Param("hasRemark") Boolean hasRemark, @Param("gender") Integer gender);

    List<Long> selectListWithNoneTag(@Param("merId") Long merId);
}
